package com.tueye.entity;

import java.sql.Timestamp;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.tueye.entity.user.Flowers;
import com.tueye.entity.user.UserCollectionInfo;

/**
 * 
 * @author yue descript: the topic of tueye change 2008/12/29 add a attribute
 *         topic_description change 2009/1/2 add a attribute topic_change
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "tueye_topics_info")
public class Topics extends BaseEntity {

	private String topic_title;
	private String topic_overview;
	private Timestamp topic_uploadDate;
	private String topic_author;
	private String topic_description;
	private String topic_from;
	// if topic_change is 1 that's 正常发布
	// if topic_change is 2 that's 近期推出
	// if topic_change is 3 that's 近期推荐变成正常发布
	private Integer topic_change;
	// if topic_change is 0 that's 没有生成静态页
	// if topic_change is 1 that's 已经生成静态页
	private Integer topic_release_type;

	private Integer topic_clickCount;
	private Integer topic_up;
	private Integer topic_down;
	private Integer topic_pageNum;

	// add by yuyue 09/5/23 添加文章编号。
	private Integer topic_code;
	private TopicType topic_type;
	private List<Pictures> pictures;
	// private List<KeyWords> keywords;
	private String keywords;

	private List<UserCollectionInfo> userCollectionInfo;

	private List<Flowers> flowers;

	// modify by yuyue 09/11/1
	private KeyWords tag; // 文章对应的标签
	private Integer topicContentType; // 文章内容类型，0 or null--最初的形式 1--纯文字 2---视频
	private String content; // 如果文章内容类型是纯文字，这里面纯的就是纯文字，如果文章内容类型是视频，这里就是视频的URL
	private List<TopicComment> topicComments; // 文章对应的评论
	private ArticleTopic articleTopic;      //文章所属专题
	

	/*
	 * @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch =
	 * FetchType.LAZY) @JoinTable(name="topic_keyword_relation", joinColumns={@JoinColumn(name="topic_id")},
	 * inverseJoinColumns={@JoinColumn(name="keyword_id")}) public List<KeyWords>
	 * getKeywords() { return keywords; } public void setKeywords(List<KeyWords>
	 * keywords) { this.keywords = keywords; }
	 */

	@OneToMany(mappedBy = "topics", cascade = CascadeType.ALL)
	public List<Pictures> getPictures() {
		return pictures;
	}

	public void setPictures(List<Pictures> pictures) {
		this.pictures = pictures;
	}

	@Column(length = 255)
	public String getTopic_title() {
		return topic_title;
	}

	public void setTopic_title(String topic_title) {
		this.topic_title = topic_title;
	}

	@Column(length = 500)
	public String getTopic_overview() {
		return topic_overview;
	}

	public void setTopic_overview(String topic_overview) {
		this.topic_overview = topic_overview;
	}

	// @Temporal(TemporalType.TIMESTAMP)
	@Column(name = "topic_uploadDate", length = 19)
	public Timestamp getTopic_uploadDate() {
		return topic_uploadDate;
	}

	public void setTopic_uploadDate(Timestamp topic_uploadDate) {
		this.topic_uploadDate = topic_uploadDate;
	}

	public String getTopic_author() {
		return topic_author;
	}

	public void setTopic_author(String topic_author) {
		this.topic_author = topic_author;
	}

	public String getTopic_from() {
		return topic_from;
	}

	public void setTopic_from(String topic_from) {
		this.topic_from = topic_from;
	}

	public Integer getTopic_clickCount() {
		return topic_clickCount;
	}

	public void setTopic_clickCount(Integer topic_clickCount) {
		this.topic_clickCount = topic_clickCount;
	}

	public Integer getTopic_up() {
		return topic_up;
	}

	public void setTopic_up(Integer topic_up) {
		this.topic_up = topic_up;
	}

	public Integer getTopic_down() {
		return topic_down;
	}

	public void setTopic_down(Integer topic_down) {
		this.topic_down = topic_down;
	}

	public Integer getTopic_pageNum() {
		return topic_pageNum;
	}

	public void setTopic_pageNum(Integer topic_pageNum) {
		this.topic_pageNum = topic_pageNum;
	}

	@ManyToOne
	public TopicType getTopic_type() {
		return topic_type;
	}

	public void setTopic_type(TopicType topic_type) {
		this.topic_type = topic_type;
	}

	public String getTopic_description() {
		return topic_description;
	}

	public void setTopic_description(String topic_description) {
		this.topic_description = topic_description;
	}

	public Integer getTopic_change() {
		return topic_change;
	}

	public void setTopic_change(Integer topic_change) {
		this.topic_change = topic_change;
	}

	public Integer getTopic_release_type() {
		return topic_release_type;
	}

	public void setTopic_release_type(Integer topic_release_type) {
		this.topic_release_type = topic_release_type;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	@OneToMany(mappedBy = "topics", cascade = CascadeType.ALL)
	public List<UserCollectionInfo> getUserCollectionInfo() {
		return userCollectionInfo;
	}

	public void setUserCollectionInfo(
			List<UserCollectionInfo> userCollectionInfo) {
		this.userCollectionInfo = userCollectionInfo;
	}

	@OneToMany(mappedBy = "topics", cascade = CascadeType.ALL)
	public List<Flowers> getFlowers() {
		return flowers;
	}

	public void setFlowers(List<Flowers> flowers) {
		this.flowers = flowers;
	}

	public Integer getTopic_code() {
		return topic_code;
	}

	public void setTopic_code(Integer topic_code) {
		this.topic_code = topic_code;
	}

	@ManyToOne
	public KeyWords getTag() {
		return tag;
	}

	public void setTag(KeyWords tag) {
		this.tag = tag;
	}

	public Integer getTopicContentType() {
		return topicContentType;
	}

	public void setTopicContentType(Integer topicContentType) {
		this.topicContentType = topicContentType;
	}

	@Column(name = "content", length = 10000)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@OneToMany(mappedBy = "topic", cascade = CascadeType.ALL)
	public List<TopicComment> getTopicComments() {
		return topicComments;
	}

	public void setTopicComments(List<TopicComment> topicComments) {
		this.topicComments = topicComments;
	}
	@ManyToOne
	public ArticleTopic getArticleTopic() {
		return articleTopic;
	}
	
	public void setArticleTopic(ArticleTopic articleTopic) {
		this.articleTopic = articleTopic;
	}
	
	

}